<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="referrer" content="no-referrer" />
    <title>淹没分析</title>
    <style>
        body {
            position: absolute;
            margin: 0;
            width: 100%;
            height: 100%;
        }

        #mapContainer {
            left: 0px;
            top: 0px;
            width: 100%;
            height: 100%;
            float: left;
        }
    </style>
</head>

<body>
    <div id="mapContainer" style="position: relative;"></div>
</body>
<script src='/GiswayEngine.js'></script>
<script type="text/javascript">
    window.app = new GE.App('mapContainer', {
        position: [119.5503034398738, 29.34501850151658, 600],
        lookAt: [119.55097987498354, 29.347578514254775, 10],
        cameraScrollSpeed: 5,
        minZoom: 3,
        maxZoom: 18,
        ambientLightIntensity: 5,
        useCarpet: false,
        background: "none",
        useDefaultTexture: false, //是否使用瓦片默认纹理
        extraStep: 4, //额外加载瓦片的步长
        polygonPointNumInShader: 25, //多边形的最大顶点数量, 该属性只在压平分析，淹没分析，压平分析中使用，如果不使用这三个分析功能不要设置该属性，否则会对性能有影响
        baseLayer: [
            {
                //  url: 'http://192.168.88.10:49999/t/HMapServer/rest/wmts/zjlx/{z}/{x}/{y}.png',
                url: ' https://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
                urlDecimal: true,
                // demUrl:'http://192.168.88.10:49999/t/tile-server/szxc/zjlx/DEM/lerc/zjlanxi-ky/_alllayers/{z}/{y}/{x}.lerc',
                demUrl: 'http://localhost:9000/examples/resources/dem/zjlx/DEM/lerc/zjlanxi-ky/_alllayers/{z}/{y}/{x}.lerc',
                demUrlDecimal: false,
                demHeightAdjust:0, 
                // tileType: 'image',
                tileType: 'dem',
                canNotSelect: false, //true表示该图层不参与射线拾取，false表示图层参与射线拾取
            },
        ]
    });

    // window.app.camera.setMaxPitchAngle(50);
    
    var bloomShape = [
            // new GE.Point(119.5511751283376,29.35140243210871, 0, '4326'),
            // new GE.Point(119.55104252327372,29.345477286875507, 0, '4326'),
            // new GE.Point(119.54702813904878,29.345201123954652, 0, '4326'),
            // new GE.Point( 119.5467783791124,29.35073682773744, 0, '4326'),

            new GE.Point(119.52314784313235, 29.366565594256755, 0, '4326'),
            new GE.Point(119.52413678579681, 29.343445779816605, 0, '4326'),
            new GE.Point(119.5586400177651, 29.341711523705506, 0, '4326'),
            new GE.Point(119.56030066670674, 29.36607671013243, 0, '4326'),
    ];
    let zoomRange = {minZoom:3, maxZoom: 22};
    var bloomAnalysis = new GE.BloomAnalysis({bloomShape: bloomShape, zoomRange: zoomRange});
       

    window.app.on('Click', function (e) {
        console.log(e);
    });

    btn();

    function btn() {
        let button1 = new GE.Button('打开淹没分析', function () {
            bloomAnalysis.openAnalysis(150, 0.01);
        });
        app.ui.add(button1);

        let button2 = new GE.Button('关闭淹没分析', function () {
            bloomAnalysis.closeAnalysis();
        });
        app.ui.add(button2);
    }



</script>

</html>